It’s exhausting staying up to date with the evolution of Java and the myriad other JVM languages. Is it worth it? What do modern languages give us?
Abstract
Many JVM languages promote “less boilerplate code” as one of their selling points. Even updates to Java in recent years have removed unnecessary syntax. While this is clearly meant to be a Good Thing, many of us - particularly if we’ve been writing Java for a long time - think “so what?". Our IDEs can generate code, and our brains get used to ignoring the stuff that doesn’t matter.
Is the removal of extraneous code from the syntax of a language necessary, or just a gimmick? How does it impact our ability to write and read code?
In this talk, Trisha will explore common coding scenarios using Java and Kotlin. We’ll see what a language designed for developer productivity looks like: what’s important for developers to write (and, more importantly, read) and what can be removed. We’ll also see how Java has evolved to improve our productivity as producers and consumers of code, and why staying up to date with the features of a language like Java can ultimately make your life easier.
Videos
Also filmed at:
The code examples from this talk are shamelessly reused from Hadi Hariri’s London Software Craftsmanship Conference talk, The Importance of Syntax In Clean Code.
Slides
Code
The code lives here.
Version information
- DevoxxUK
- Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
- Kotlin: 1.2.31
- IDE: IntelliJ IDEA 2018.1.3 (Ultimate Edition) Build #IU-181.4892.42
- QCon London
- Java(TM) SE Runtime Environment 18.3 (build 10+45)
- Kotlin: 1.2.21
- IDE: IntelliJ IDEA 2018.1 EAP (Ultimate Edition) Build #IU-181.3986.9
Resources
Java
- Java 5: Generics
- Java 7: Diamond operator
- Java 8: Optional
- Java 8: Streams
- Java 8: IntStream
- Java 8: Lambda Expressions
- Java 9: More methods on Optional
- Java 9: Convenience Factory Methods for Collections
- Java 10: Local-variable type inference
- JDK 11 early access releases
- Java 11 Open JDK page (tracks which features are currently going into Java 11)
- Java 12: JEP 325: Switch expressions (Preview)
- Java 13?: JEP 302: Lambda Leftovers (including underscore for param)
- Java 13?: JEP 305: Pattern Matching (Preview)
- Java??: Data Classes for Java and Brian Goetz on Data Classes for Java
Kotlin
- Data Classes
- Lambdas and higher order functions
- Properties (var/val)
- Equality (== vs ===)
- Type Checks and Casts
- Null Safety
- when
- Default arguments
- Sequences
- Ranges
- Collections